﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.IO;
using System.Windows.Forms;


namespace Manager
{
    public class ImageHandler
    {
        private static List<string> _Images = new List<string>(30);
        private static List<Bitmap> Thumbnails = new List<Bitmap>(30);
        private static MemoryStream bmpStream = new MemoryStream();
        public static ListBox lBox;
        public static PictureBox _pBox;

        public static List<Bitmap> Thumbs
        {
            get
            {
                return Thumbnails;

            }

        }

        public static List<string> StringThumb
        {
            get
            {
                return _Images;
            }

        }

        public static int pListIndex = 0;
        
        public static void StoreImage(string URL){

            try
            {

                Thumbnails.Add(new Bitmap(URL));
            }
            catch (Exception pEx)
            {

                MessageBox.Show("Formato nao Suportado:"+  pEx.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                
            }
        }

        public static void ImageString(string URL)
        {

            _Images.Add(URL);

        }

        public static Bitmap ReturnImage(int index)
        {

            return Thumbnails[index] ;


        }

        public static string ReturnString(int index)
        {
            try
            {
                if (index < 0)
                {
                    index = 0;

                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);

            }
           
                return _Images[index];

           
            
        }

        public static int ListIndex(ListBox List)
        {


            pListIndex = List.SelectedIndex;
            lBox = List;

            return pListIndex; 
           

        }

        




               

       

    }
}
